package configuration.options;

import clock.Clock;
import database.mediator.MediatorInterface;
import distributedRE.model.DistributedREModel;
import distributedRE.model.Session;

public abstract class AdjustmentOption {

	private long id;
	private int K;
	private long round;
	
	public AdjustmentOption(long id, int K){
		this.id = id;
		this.K = K;
		
		round = 0;
	}
	
	public void adaptReporter(DistributedREModel dREModel, Session s, MediatorInterface mI){
		
		
		round++;
		
		if (round >= K){

			round = 0;
		
			Clock.startTime();
			
			adapt(dREModel,s,mI);
			
			Clock.stopTime();
			
			mI.writeAdaptiveStep(s.getExperiment_id(),s.getId(), this.getId(),Clock.getMeasuredTime());

		}
	}

	protected abstract void adapt(DistributedREModel dREModel, Session s, MediatorInterface mI);
	
	private long getId(){
		return id;
	}

	
}
